package study.week05.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import study.week05.entity.Student;

@Configuration
public class ConditionBeanConfig {

    //@Bean
    public Student studentBase(){
        Student stu = new Student();
        stu.setAge(18);
        stu.setStudentName("测试学生");
        return stu;
    }

    @ConditionalOnMissingBean
    @Bean
    public Student studentCondition(){
        Student stu = new Student();
        stu.setAge(18);
        stu.setStudentName("测试学生");
        return stu;
    }


}
